import React from 'react'
import { Table } from 'antd'
import { ColumnProps } from 'antd/lib/table'

const colums: any = (): ColumnProps<any>[] => [
  {
    title: '序号',
    dataIndex: 'id',
    align: 'center',
    render: (_: any, record: any, index: number) => <div>{index + 1}</div>
  },
  {
    title: '接收用户',
    dataIndex: 'receiveUserName',
    align: 'center',
    render: (receiveUserName: any) => <a>{receiveUserName}</a>
  },
  {
    title: '制作单位',
    dataIndex: 'makeCompanyName',
    align: 'center',
    render: (makeCompanyName: any) => <a>{makeCompanyName}</a>
  },
  // {
  //   title: '数量（单位）',
  //   dataIndex: 'age2',
  //   render: (itemName: any, record: any) => (
  //     <div>
  //       {record.itemStock.totalNumber} {record.itemStock.unitName}
  //     </div>
  //   )
  // },
  {
    title: '制作部门',
    dataIndex: 'makeDepartmentName',
    align: 'center',
    render: (makeDepartmentName: any) => <a>{makeDepartmentName}</a>
  },
  {
    title: '申请用户',
    align: 'center',
    dataIndex: 'applyUserName',
    key: 'applyUserName'
  }
]

const WaitingList = ({ waitCastItems }: any) => {
  return (
    <div>
      <Table
        pagination={{
          size: 'default',
          total: waitCastItems.length,
          showSizeChanger: true,
          showQuickJumper: true,
          showTotal: total => `共 ${total} 条`
        }}
        bordered
        rowKey="id"
        dataSource={waitCastItems}
        columns={colums()}
      />
    </div>
  )
}

export default WaitingList
